<template>
  <Dialog @confirm="confirm" :title="title" ref="dialog">
    <Form  ref="form" v-bind="$attrs" ></Form>
  </Dialog>
</template>

<script>
export default {
  name: "DF",
  props: {
    /**
     * 标题
     */
    title: String,
  },
  data() {
    return {};
  },
  methods: {
    /**
     * 显示
     */
    show() {
      this.$refs.dialog.show();
    },
    /**
     * 隐藏
     */
    hide() {
      this.$refs.dialog.hide();
    },
    /**
     * 开启loading
     */
    start() {
      this.$refs.dialog.start();
    },
    /**
     * 停止loading
     */
    stop() {
         this.$refs.dialog.stop();
    },
    /**
     * 重置
     */
    reset(){
      this.$refs.dialog.reset();
    },
    /**
     * 提交
     */
    async confirm() {
      try {
        const model = await this.$refs.form.validate();
        this.$emit("confirm", model);
      } catch (error) {}
    },
  }
};
</script>

<style lang='less' scoped>
</style>